package com.xuecheng.search.controller;

import com.xuecheng.commons.model.dto.CoursePubIndexDto;
import com.xuecheng.commons.model.dto.PageRequest;
import com.xuecheng.commons.model.vo.ResponseResult;
import com.xuecheng.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
public class SearchController {
    @Autowired
    private SearchService searchService;
    @PostMapping("/course-search")
    public ResponseResult getCourse(PageRequest pageParam, @RequestBody CoursePubIndexDto dto) throws IOException {
        return searchService.getCourse(pageParam,dto);

    }
    @GetMapping("/course-search/{id}")
    public ResponseResult getPubCourseById(@PathVariable String id ) throws IOException {
        return searchService.getPubCourseById(id);

    }
}
